<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>树洞交友 - 发现身边的故事</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #ec4899;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-light: #9ca3af;
            --bg-light: #f9fafb;
            --bg-white: #ffffff;
            --border-light: #e5e7eb;
            --radius: 10px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 55px;
            padding-bottom: 65px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 55px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 15px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: var(--shadow);
        }
        
        .nav-title {
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--primary);
        }
        
        .nav-actions {
            display: flex;
            gap: 18px;
            font-size: 1.25rem;
            color: var(--text-secondary);
        }
        
        /* 搜索栏 */
        .search-bar {
            padding: 12px 15px;
            background-color: var(--bg-white);
        }
        
        .search-input-group {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 15px 10px 40px;
            border-radius: 20px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 0.9rem;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
        }
        
        .search-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 分类标签 */
        .category-tabs {
            display: flex;
            padding: 8px 15px;
            background-color: var(--bg-white);
            overflow-x: auto;
            scrollbar-width: none;
            border-bottom: 1px solid var(--border-light);
        }
        
        .category-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .category-tab {
            padding: 6px 15px;
            border-radius: 15px;
            font-size: 0.9rem;
            white-space: nowrap;
            margin-right: 8px;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
        }
        
        .category-tab.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 树洞列表 */
        .treehole-list {
            padding: 0 15px;
        }
        
        .treehole-item {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            padding: 15px;
            margin-top: 12px;
            box-shadow: var(--shadow);
        }
        
        .treehole-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .user-name {
            font-weight: 500;
            font-size: 0.95rem;
        }
        
        .post-time {
            font-size: 0.8rem;
            color: var(--text-light);
        }
        
        .more-options {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1rem;
        }
        
        .treehole-content {
            margin-bottom: 12px;
            line-height: 1.5;
            font-size: 0.95rem;
        }
        
        /* 图片容器 - 支持不同数量图片的布局 */
        .images-container {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 6px;
            margin-bottom: 12px;
            border-radius: 6px;
            overflow: hidden;
        }
        
        .images-container.single {
            grid-template-columns: 1fr;
            max-height: 300px;
        }
        
        .images-container.double {
            grid-template-columns: repeat(2, 1fr);
        }
        
        .treehole-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            aspect-ratio: 1/1;
        }
        
        .images-container.single .treehole-image {
            aspect-ratio: 4/3;
        }
        
        /* 互动区域 */
        .treehole-actions {
            display: flex;
            justify-content: space-between;
            padding-top: 8px;
            border-top: 1px solid var(--border-light);
        }
        
        .action-btn {
            display: flex;
            align-items: center;
            gap: 5px;
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 0.85rem;
            padding: 5px 0;
        }
        
        .action-btn.liked {
            color: var(--danger);
        }
        
        .action-btn i {
            font-size: 1rem;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
        }
        
        .nav-item i {
            font-size: 1.3rem;
            margin-bottom: 3px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .add-post-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: var(--primary);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            margin-top: -25px;
            box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
        }
        
        /* 骨架屏样式 */
        .skeleton {
            background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
            background-size: 200% 100%;
            animation: skeleton-loading 1.5s infinite;
        }
        
        @keyframes skeleton-loading {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }
        
        .skeleton-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
        }
        
        .skeleton-text {
            height: 16px;
            border-radius: 4px;
            margin-bottom: 8px;
        }
        
        .skeleton-text.short {
            width: 40%;
        }
        
        .skeleton-text.medium {
            width: 70%;
        }
        
        .skeleton-text.long {
            width: 100%;
        }
        
        .skeleton-image {
            width: 100%;
            height: 100%;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <div class="nav-logo">
            <i class="fas fa-tree"></i>
        </div>
        <div class="nav-title">树洞交友</div>
        <div class="nav-actions">
            <i class="far fa-bell"></i>
            <i class="far fa-envelope"></i>
        </div>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-bar">
        <div class="search-input-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索树洞、话题或用户...">
        </div>
    </div>
    
    <!-- 分类标签 -->
    <div class="category-tabs">
        <button class="category-tab active">推荐</button>
        <button class="category-tab">附近</button>
        <button class="category-tab">情感</button>
        <button class="category-tab">兴趣</button>
        <button class="category-tab">校园</button>
        <button class="category-tab">职场</button>
        <button class="category-tab">爱好</button>
        <button class="category-tab">匿名</button>
    </div>
    
    <!-- 树洞列表 -->
    <div class="treehole-list">
        <!-- 无图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/64/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">星辰大海</div>
                        <div class="post-time">2小时前 · 情感</div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                最近感觉很迷茫，不知道自己真正想要的是什么。工作稳定但没有激情，想辞职又怕找不到更好的。有没有人有过类似的经历，能给点建议吗？
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>32</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-heart"></i>
                    <span>56</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 单图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/65/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">咖啡不加糖</div>
                        <div class="post-time">昨天 19:45 · 爱好</div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                周末发现的一家小众咖啡馆，环境特别好，咖啡也很正宗。有没有喜欢探店的朋友，下次可以一起啊~
            </div>
            <div class="images-container single">
                <img src="https://picsum.photos/id/431/800/600" alt="咖啡馆照片" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>18</span>
                </button>
                <button class="action-btn liked">
                    <i class="fas fa-heart"></i>
                    <span>94</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 双图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/66/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">徒步旅行者</div>
                        <div class="post-time">3天前 · 兴趣</div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                上周去了附近的徒步路线，风景太美了！全程10公里，难度适中，适合新手尝试。有没有喜欢徒步的朋友，组队一起啊~
            </div>
            <div class="images-container double">
                <img src="https://picsum.photos/id/29/400/400" alt="徒步照片1" class="treehole-image">
                <img src="https://picsum.photos/id/133/400/400" alt="徒步照片2" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>45</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-heart"></i>
                    <span>128</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 三图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/67/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">美食探险家</div>
                        <div class="post-time">4天前 · 爱好</div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                周末在家尝试做了三道新菜，味道居然还不错！有没有喜欢烹饪的朋友，交流一下经验呀~
            </div>
            <div class="images-container">
                <img src="https://picsum.photos/id/292/400/400" alt="美食照片1" class="treehole-image">
                <img src="https://picsum.photos/id/431/400/400" alt="美食照片2" class="treehole-image">
                <img src="https://picsum.photos/id/488/400/400" alt="美食照片3" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>67</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-heart"></i>
                    <span>215</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 四图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/68/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">城市漫游者</div>
                        <div class="post-time">5天前 · 兴趣</div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                用周末时间逛了逛城市里的老街区，发现了很多有意思的小店和角落。这座城市总有新的惊喜等着我们发现~
            </div>
            <div class="images-container">
                <img src="https://picsum.photos/id/1067/400/400" alt="城市照片1" class="treehole-image">
                <img src="https://picsum.photos/id/1068/400/400" alt="城市照片2" class="treehole-image">
                <img src="https://picsum.photos/id/1069/400/400" alt="城市照片3" class="treehole-image">
                <img src="https://picsum.photos/id/1070/400/400" alt="城市照片4" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>38</span>
                </button>
                <button class="action-btn liked">
                    <i class="fas fa-heart"></i>
                    <span>156</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
        
        <!-- 六图树洞 -->
        <div class="treehole-item">
            <div class="treehole-header">
                <div class="user-info">
                    <img src="https://picsum.photos/id/69/100/100" alt="用户头像" class="user-avatar">
                    <div>
                        <div class="user-name">摄影爱好者</div>
                        <div class="post-time">1周前 · 爱好</div>
                    </div>
                </div>
                <button class="more-options">
                    <i class="fas fa-ellipsis-h"></i>
                </button>
            </div>
            <div class="treehole-content">
                整理了一下这个月拍的照片，分享给大家。主要是一些城市风光和街头瞬间，希望大家喜欢~ 求指教！
            </div>
            <div class="images-container">
                <img src="https://picsum.photos/id/1015/400/400" alt="摄影作品1" class="treehole-image">
                <img src="https://picsum.photos/id/1016/400/400" alt="摄影作品2" class="treehole-image">
                <img src="https://picsum.photos/id/1018/400/400" alt="摄影作品3" class="treehole-image">
                <img src="https://picsum.photos/id/1019/400/400" alt="摄影作品4" class="treehole-image">
                <img src="https://picsum.photos/id/1039/400/400" alt="摄影作品5" class="treehole-image">
                <img src="https://picsum.photos/id/1043/400/400" alt="摄影作品6" class="treehole-image">
            </div>
            <div class="treehole-actions">
                <button class="action-btn">
                    <i class="far fa-comment"></i>
                    <span>89</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-heart"></i>
                    <span>324</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-star"></i>
                    <span>收藏</span>
                </button>
                <button class="action-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
            </div>
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <div class="nav-item active">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </div>
        <div class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </div>
        <div class="add-post-btn">
            <i class="fas fa-plus"></i>
        </div>
        <div class="nav-item">
            <i class="far fa-bell"></i>
            <span>通知</span>
        </div>
        <div class="nav-item">
            <i class="far fa-user"></i>
            <span>我的</span>
        </div>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // 分类标签切换
        const categoryTabs = document.querySelectorAll('.category-tab');
        categoryTabs.forEach(tab => {
            tab.addEventListener('click', () => {
                categoryTabs.forEach(t => t.classList.remove('active'));
                tab.classList.add('active');
                
                // 模拟加载新内容
                loadNewContent();
            });
        });
        
        // 点赞功能
        const likeButtons = document.querySelectorAll('.action-btn');
        likeButtons.forEach(button => {
            if (button.querySelector('.fa-heart')) {
                button.addEventListener('click', () => {
                    const icon = button.querySelector('i');
                    const countEl = button.querySelector('span');
                    let count = parseInt(countEl.textContent);
                    
                    if (icon.classList.contains('far')) {
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        button.classList.add('liked');
                        countEl.textContent = count + 1;
                    } else {
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        button.classList.remove('liked');
                        countEl.textContent = count - 1;
                    }
                });
            }
        });
        
        // 模拟加载新内容
        function loadNewContent() {
            const treeholeList = document.querySelector('.treehole-list');
            const originalContent = treeholeList.innerHTML;
            
            // 显示骨架屏
            treeholeList.innerHTML = `
                <div class="treehole-item">
                    <div class="treehole-header">
                        <div class="user-info">
                            <div class="skeleton skeleton-avatar"></div>
                            <div>
                                <div class="skeleton skeleton-text short"></div>
                                <div class="skeleton skeleton-text short"></div>
                            </div>
                        </div>
                    </div>
                    <div class="treehole-content">
                        <div class="skeleton skeleton-text medium"></div>
                        <div class="skeleton skeleton-text long"></div>
                        <div class="skeleton skeleton-text long"></div>
                    </div>
                    <div class="images-container">
                        <div class="skeleton skeleton-image"></div>
                        <div class="skeleton skeleton-image"></div>
                        <div class="skeleton skeleton-image"></div>
                    </div>
                </div>
                <div class="treehole-item">
                    <div class="treehole-header">
                        <div class="user-info">
                            <div class="skeleton skeleton-avatar"></div>
                            <div>
                                <div class="skeleton skeleton-text short"></div>
                                <div class="skeleton skeleton-text short"></div>
                            </div>
                        </div>
                    </div>
                    <div class="treehole-content">
                        <div class="skeleton skeleton-text long"></div>
                        <div class="skeleton skeleton-text long"></div>
                        <div class="skeleton skeleton-text medium"></div>
                    </div>
                </div>
            `;
            
            // 2秒后恢复内容
            setTimeout(() => {
                treeholeList.innerHTML = originalContent;
                // 重新绑定事件
                bindEvents();
            }, 1500);
        }
        
        // 下拉加载更多
        let isLoading = false;
        window.addEventListener('scroll', () => {
            // 当滚动到页面底部附近时加载更多
            if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 300 && !isLoading) {
                loadMoreContent();
            }
        });
        
        // 加载更多内容
        function loadMoreContent() {
            isLoading = true;
            const treeholeList = document.querySelector('.treehole-list');
            
            // 添加加载提示
            const loadingIndicator = document.createElement('div');
            loadingIndicator.className = 'text-center py-3';
            loadingIndicator.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载更多内容...';
            treeholeList.appendChild(loadingIndicator);
            
            // 模拟加载延迟
            setTimeout(() => {
                // 克隆现有内容作为新内容
                const existingItems = document.querySelectorAll('.treehole-item');
                existingItems.forEach((item, index) => {
                    if (index < 2) { // 只克隆前2项
                        const clonedItem = item.cloneNode(true);
                        // 更新时间为更早的时间
                        const timeEl = clonedItem.querySelector('.post-time');
                        const days = Math.floor(Math.random() * 10) + 7;
                        timeEl.textContent = `${days}天前 · ${timeEl.textContent.split(' · ')[1]}`;
                        
                        // 重置点赞状态
                        const likeBtn = clonedItem.querySelector('.action-btn');
                        if (likeBtn && likeBtn.querySelector('.fa-heart')) {
                            const icon = likeBtn.querySelector('i');
                            const countEl = likeBtn.querySelector('span');
                            likeBtn.classList.remove('liked');
                            icon.classList.remove('fas');
                            icon.classList.add('far');
                            countEl.textContent = Math.floor(Math.random() * 200);
                        }
                        
                        treeholeList.insertBefore(clonedItem, loadingIndicator);
                    }
                });
                
                // 移除加载提示
                treeholeList.removeChild(loadingIndicator);
                isLoading = false;
                // 重新绑定事件
                bindEvents();
            }, 1500);
        }
        
        // 重新绑定事件
        function bindEvents() {
            // 重新绑定点赞事件
            const likeButtons = document.querySelectorAll('.action-btn');
            likeButtons.forEach(button => {
                if (button.querySelector('.fa-heart') && !button.onclick) {
                    button.addEventListener('click', () => {
                        const icon = button.querySelector('i');
                        const countEl = button.querySelector('span');
                        let count = parseInt(countEl.textContent);
                        
                        if (icon.classList.contains('far')) {
                            icon.classList.remove('far');
                            icon.classList.add('fas');
                            button.classList.add('liked');
                            countEl.textContent = count + 1;
                        } else {
                            icon.classList.remove('fas');
                            icon.classList.add('far');
                            button.classList.remove('liked');
                            countEl.textContent = count - 1;
                        }
                    });
                }
            });
        }
        
        // 发布按钮点击事件
        document.querySelector('.add-post-btn').addEventListener('click', () => {
            alert('跳转到发布树洞页面');
        });
    </script>
</body>
</html>

